\(\int \cos (a+b x) \csc (c+b x) \, dx\) [227]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [C] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 27 \[ \int \cos (a+b x) \csc (c+b x) \, dx=\frac {\cos (a-c) \log (\sin (c+b x))}{b}-x \sin (a-c) \]

[Out]

cos(a-c)*ln(sin(b*x+c))/b-x*sin(a-c)

Rubi [A] (verified)

Time = 0.02 (sec) , antiderivative size = 27, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {4677, 3556, 8} \[ \int \cos (a+b x) \csc (c+b x) \, dx=\frac {\cos (a-c) \log (\sin (b x+c))}{b}-x \sin (a-c) \]

[In]

Int[Cos[a + b*x]*Csc[c + b*x],x]

[Out]

(Cos[a - c]*Log[Sin[c + b*x]])/b - x*Sin[a - c]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 4677

Int[Cos[v_]*Csc[w_]^(n_.), x_Symbol] :> Dist[Cos[v - w], Int[Cot[w]*Csc[w]^(n - 1), x], x] - Dist[Sin[v - w],
Int[Csc[w]^(n - 1), x], x] /; GtQ[n, 0] && FreeQ[v - w, x] && NeQ[w, v]

Rubi steps \begin{align*} \text {integral}& = \cos (a-c) \int \cot (c+b x) \, dx-\sin (a-c) \int 1 \, dx \\ & = \frac {\cos (a-c) \log (\sin (c+b x))}{b}-x \sin (a-c) \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.28 (sec) , antiderivative size = 58, normalized size of antiderivative = 2.15 \[ \int \cos (a+b x) \csc (c+b x) \, dx=\frac {-2 i \arctan (\tan (c+b x)) \cos (a-c)+\cos (a-c) \left (2 i b x+\log \left (\sin ^2(c+b x)\right )\right )-2 b x \sin (a-c)}{2 b} \]

[In]

Integrate[Cos[a + b*x]*Csc[c + b*x],x]

[Out]

((-2*I)*ArcTan[Tan[c + b*x]]*Cos[a - c] + Cos[a - c]*((2*I)*b*x + Log[Sin[c + b*x]^2]) - 2*b*x*Sin[a - c])/(2*
b)

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 1.09 (sec) , antiderivative size = 70, normalized size of antiderivative = 2.59

method result size
risch \(i x \,{\mathrm e}^{i \left (a -c \right )}-2 i \cos \left (a -c \right ) x -\frac {2 i \cos \left (a -c \right ) a}{b}+\frac {\ln \left ({\mathrm e}^{2 i \left (x b +a \right )}-{\mathrm e}^{2 i \left (a -c \right )}\right ) \cos \left (a -c \right )}{b}\) \(70\)
default \(\frac {\frac {\frac {\left (-\cos \left (a \right ) \cos \left (c \right )-\sin \left (a \right ) \sin \left (c \right )\right ) \ln \left (1+\tan \left (x b +a \right )^{2}\right )}{2}+\left (\cos \left (a \right ) \sin \left (c \right )-\sin \left (a \right ) \cos \left (c \right )\right ) \arctan \left (\tan \left (x b +a \right )\right )}{\left (\cos \left (c \right )^{2}+\sin \left (c \right )^{2}\right ) \left (\cos \left (a \right )^{2}+\sin \left (a \right )^{2}\right )}+\frac {\left (\cos \left (a \right ) \cos \left (c \right )+\sin \left (a \right ) \sin \left (c \right )\right ) \ln \left (\tan \left (x b +a \right ) \cos \left (a \right ) \cos \left (c \right )+\tan \left (x b +a \right ) \sin \left (a \right ) \sin \left (c \right )-\sin \left (a \right ) \cos \left (c \right )+\cos \left (a \right ) \sin \left (c \right )\right )}{\cos \left (a \right )^{2} \cos \left (c \right )^{2}+\cos \left (c \right )^{2} \sin \left (a \right )^{2}+\cos \left (a \right )^{2} \sin \left (c \right )^{2}+\sin \left (a \right )^{2} \sin \left (c \right )^{2}}}{b}\) \(162\)

[In]

int(cos(b*x+a)/sin(b*x+c),x,method=_RETURNVERBOSE)

[Out]

I*x*exp(I*(a-c))-2*I*cos(a-c)*x-2*I/b*cos(a-c)*a+ln(exp(2*I*(b*x+a))-exp(2*I*(a-c)))/b*cos(a-c)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.11 \[ \int \cos (a+b x) \csc (c+b x) \, dx=\frac {b x \sin \left (-a + c\right ) + \cos \left (-a + c\right ) \log \left (\frac {1}{2} \, \sin \left (b x + c\right )\right )}{b} \]

[In]

integrate(cos(b*x+a)/sin(b*x+c),x, algorithm="fricas")

[Out]

(b*x*sin(-a + c) + cos(-a + c)*log(1/2*sin(b*x + c)))/b

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 201 vs. \(2 (20) = 40\).

Time = 4.54 (sec) , antiderivative size = 333, normalized size of antiderivative = 12.33 \[ \int \cos (a+b x) \csc (c+b x) \, dx=- \left (\begin {cases} 0 & \text {for}\: b = 0 \wedge c = 0 \\x & \text {for}\: c = 0 \\0 & \text {for}\: b = 0 \\- \frac {b x \tan ^{2}{\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} + \frac {b x}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} - \frac {2 \log {\left (\tan {\left (\frac {c}{2} \right )} + \tan {\left (\frac {b x}{2} \right )} \right )} \tan {\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} - \frac {2 \log {\left (\tan {\left (\frac {b x}{2} \right )} - \frac {1}{\tan {\left (\frac {c}{2} \right )}} \right )} \tan {\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} + \frac {2 \log {\left (\tan ^{2}{\left (\frac {b x}{2} \right )} + 1 \right )} \tan {\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} & \text {otherwise} \end {cases}\right ) \sin {\left (a \right )} + \left (\begin {cases} \tilde {\infty } x & \text {for}\: b = 0 \wedge c = 0 \\\frac {\log {\left (\sin {\left (b x \right )} \right )}}{b} & \text {for}\: c = 0 \\\frac {x}{\sin {\left (c \right )}} & \text {for}\: b = 0 \\\frac {2 b x \tan {\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} - \frac {\log {\left (\tan {\left (\frac {c}{2} \right )} + \tan {\left (\frac {b x}{2} \right )} \right )} \tan ^{2}{\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} + \frac {\log {\left (\tan {\left (\frac {c}{2} \right )} + \tan {\left (\frac {b x}{2} \right )} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} - \frac {\log {\left (\tan {\left (\frac {b x}{2} \right )} - \frac {1}{\tan {\left (\frac {c}{2} \right )}} \right )} \tan ^{2}{\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} + \frac {\log {\left (\tan {\left (\frac {b x}{2} \right )} - \frac {1}{\tan {\left (\frac {c}{2} \right )}} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} + \frac {\log {\left (\tan ^{2}{\left (\frac {b x}{2} \right )} + 1 \right )} \tan ^{2}{\left (\frac {c}{2} \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} - \frac {\log {\left (\tan ^{2}{\left (\frac {b x}{2} \right )} + 1 \right )}}{b \tan ^{2}{\left (\frac {c}{2} \right )} + b} & \text {otherwise} \end {cases}\right ) \cos {\left (a \right )} \]

[In]

integrate(cos(b*x+a)/sin(b*x+c),x)

[Out]

-Piecewise((0, Eq(b, 0) & Eq(c, 0)), (x, Eq(c, 0)), (0, Eq(b, 0)), (-b*x*tan(c/2)**2/(b*tan(c/2)**2 + b) + b*x
/(b*tan(c/2)**2 + b) - 2*log(tan(c/2) + tan(b*x/2))*tan(c/2)/(b*tan(c/2)**2 + b) - 2*log(tan(b*x/2) - 1/tan(c/
2))*tan(c/2)/(b*tan(c/2)**2 + b) + 2*log(tan(b*x/2)**2 + 1)*tan(c/2)/(b*tan(c/2)**2 + b), True))*sin(a) + Piec
ewise((zoo*x, Eq(b, 0) & Eq(c, 0)), (log(sin(b*x))/b, Eq(c, 0)), (x/sin(c), Eq(b, 0)), (2*b*x*tan(c/2)/(b*tan(
c/2)**2 + b) - log(tan(c/2) + tan(b*x/2))*tan(c/2)**2/(b*tan(c/2)**2 + b) + log(tan(c/2) + tan(b*x/2))/(b*tan(
c/2)**2 + b) - log(tan(b*x/2) - 1/tan(c/2))*tan(c/2)**2/(b*tan(c/2)**2 + b) + log(tan(b*x/2) - 1/tan(c/2))/(b*
tan(c/2)**2 + b) + log(tan(b*x/2)**2 + 1)*tan(c/2)**2/(b*tan(c/2)**2 + b) - log(tan(b*x/2)**2 + 1)/(b*tan(c/2)
**2 + b), True))*cos(a)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 106 vs. \(2 (27) = 54\).

Time = 0.24 (sec) , antiderivative size = 106, normalized size of antiderivative = 3.93 \[ \int \cos (a+b x) \csc (c+b x) \, dx=\frac {2 \, b x \sin \left (-a + c\right ) + \cos \left (-a + c\right ) \log \left (\cos \left (b x\right )^{2} + 2 \, \cos \left (b x\right ) \cos \left (c\right ) + \cos \left (c\right )^{2} + \sin \left (b x\right )^{2} - 2 \, \sin \left (b x\right ) \sin \left (c\right ) + \sin \left (c\right )^{2}\right ) + \cos \left (-a + c\right ) \log \left (\cos \left (b x\right )^{2} - 2 \, \cos \left (b x\right ) \cos \left (c\right ) + \cos \left (c\right )^{2} + \sin \left (b x\right )^{2} + 2 \, \sin \left (b x\right ) \sin \left (c\right ) + \sin \left (c\right )^{2}\right )}{2 \, b} \]

[In]

integrate(cos(b*x+a)/sin(b*x+c),x, algorithm="maxima")

[Out]

1/2*(2*b*x*sin(-a + c) + cos(-a + c)*log(cos(b*x)^2 + 2*cos(b*x)*cos(c) + cos(c)^2 + sin(b*x)^2 - 2*sin(b*x)*s
in(c) + sin(c)^2) + cos(-a + c)*log(cos(b*x)^2 - 2*cos(b*x)*cos(c) + cos(c)^2 + sin(b*x)^2 + 2*sin(b*x)*sin(c)
 + sin(c)^2))/b

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 482 vs. \(2 (27) = 54\).

Time = 0.33 (sec) , antiderivative size = 482, normalized size of antiderivative = 17.85 \[ \int \cos (a+b x) \csc (c+b x) \, dx=-\frac {\frac {4 \, {\left (\tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right ) - \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, a\right ) - \tan \left (\frac {1}{2} \, c\right )\right )} {\left (b x + a\right )}}{\tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, a\right )^{2} + \tan \left (\frac {1}{2} \, c\right )^{2} + 1} + \frac {{\left (\tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} - \tan \left (\frac {1}{2} \, a\right )^{2} + 4 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right ) - \tan \left (\frac {1}{2} \, c\right )^{2} + 1\right )} \log \left (\tan \left (b x + a\right )^{2} + 1\right )}{\tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} + \tan \left (\frac {1}{2} \, a\right )^{2} + \tan \left (\frac {1}{2} \, c\right )^{2} + 1} - \frac {2 \, {\left (\tan \left (\frac {1}{2} \, a\right )^{4} \tan \left (\frac {1}{2} \, c\right )^{4} - 2 \, \tan \left (\frac {1}{2} \, a\right )^{4} \tan \left (\frac {1}{2} \, c\right )^{2} + 8 \, \tan \left (\frac {1}{2} \, a\right )^{3} \tan \left (\frac {1}{2} \, c\right )^{3} - 2 \, \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{4} + \tan \left (\frac {1}{2} \, a\right )^{4} - 8 \, \tan \left (\frac {1}{2} \, a\right )^{3} \tan \left (\frac {1}{2} \, c\right ) + 20 \, \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} - 8 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{3} + \tan \left (\frac {1}{2} \, c\right )^{4} - 2 \, \tan \left (\frac {1}{2} \, a\right )^{2} + 8 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right ) - 2 \, \tan \left (\frac {1}{2} \, c\right )^{2} + 1\right )} \log \left ({\left | \tan \left (b x + a\right ) \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right )^{2} - \tan \left (b x + a\right ) \tan \left (\frac {1}{2} \, a\right )^{2} + 4 \, \tan \left (b x + a\right ) \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right ) - 2 \, \tan \left (\frac {1}{2} \, a\right )^{2} \tan \left (\frac {1}{2} \, c\right ) - \tan \left (b x + a\right ) \tan \left (\frac {1}{2} \, c\right )^{2} + 2 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{2} + \tan \left (b x + a\right ) - 2 \, \tan \left (\frac {1}{2} \, a\right ) + 2 \, \tan \left (\frac {1}{2} \, c\right ) \right |}\right )}{\tan \left (\frac {1}{2} \, a\right )^{4} \tan \left (\frac {1}{2} \, c\right )^{4} + 4 \, \tan \left (\frac {1}{2} \, a\right )^{3} \tan \left (\frac {1}{2} \, c\right )^{3} - \tan \left (\frac {1}{2} \, a\right )^{4} + 4 \, \tan \left (\frac {1}{2} \, a\right )^{3} \tan \left (\frac {1}{2} \, c\right ) + 4 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right )^{3} - \tan \left (\frac {1}{2} \, c\right )^{4} + 4 \, \tan \left (\frac {1}{2} \, a\right ) \tan \left (\frac {1}{2} \, c\right ) + 1}}{2 \, b} \]

[In]

integrate(cos(b*x+a)/sin(b*x+c),x, algorithm="giac")

[Out]

-1/2*(4*(tan(1/2*a)^2*tan(1/2*c) - tan(1/2*a)*tan(1/2*c)^2 + tan(1/2*a) - tan(1/2*c))*(b*x + a)/(tan(1/2*a)^2*
tan(1/2*c)^2 + tan(1/2*a)^2 + tan(1/2*c)^2 + 1) + (tan(1/2*a)^2*tan(1/2*c)^2 - tan(1/2*a)^2 + 4*tan(1/2*a)*tan
(1/2*c) - tan(1/2*c)^2 + 1)*log(tan(b*x + a)^2 + 1)/(tan(1/2*a)^2*tan(1/2*c)^2 + tan(1/2*a)^2 + tan(1/2*c)^2 +
 1) - 2*(tan(1/2*a)^4*tan(1/2*c)^4 - 2*tan(1/2*a)^4*tan(1/2*c)^2 + 8*tan(1/2*a)^3*tan(1/2*c)^3 - 2*tan(1/2*a)^
2*tan(1/2*c)^4 + tan(1/2*a)^4 - 8*tan(1/2*a)^3*tan(1/2*c) + 20*tan(1/2*a)^2*tan(1/2*c)^2 - 8*tan(1/2*a)*tan(1/
2*c)^3 + tan(1/2*c)^4 - 2*tan(1/2*a)^2 + 8*tan(1/2*a)*tan(1/2*c) - 2*tan(1/2*c)^2 + 1)*log(abs(tan(b*x + a)*ta
n(1/2*a)^2*tan(1/2*c)^2 - tan(b*x + a)*tan(1/2*a)^2 + 4*tan(b*x + a)*tan(1/2*a)*tan(1/2*c) - 2*tan(1/2*a)^2*ta
n(1/2*c) - tan(b*x + a)*tan(1/2*c)^2 + 2*tan(1/2*a)*tan(1/2*c)^2 + tan(b*x + a) - 2*tan(1/2*a) + 2*tan(1/2*c))
)/(tan(1/2*a)^4*tan(1/2*c)^4 + 4*tan(1/2*a)^3*tan(1/2*c)^3 - tan(1/2*a)^4 + 4*tan(1/2*a)^3*tan(1/2*c) + 4*tan(
1/2*a)*tan(1/2*c)^3 - tan(1/2*c)^4 + 4*tan(1/2*a)*tan(1/2*c) + 1))/b

Mupad [B] (verification not implemented)

Time = 0.86 (sec) , antiderivative size = 115, normalized size of antiderivative = 4.26 \[ \int \cos (a+b x) \csc (c+b x) \, dx=-x\,\left (\frac {{\mathrm {e}}^{-a\,1{}\mathrm {i}+c\,1{}\mathrm {i}}\,1{}\mathrm {i}}{2}-\frac {{\mathrm {e}}^{a\,1{}\mathrm {i}-c\,1{}\mathrm {i}}\,1{}\mathrm {i}}{2}\right )-x\,\left (\frac {{\mathrm {e}}^{-a\,1{}\mathrm {i}+c\,1{}\mathrm {i}}\,1{}\mathrm {i}}{2}+\frac {{\mathrm {e}}^{a\,1{}\mathrm {i}-c\,1{}\mathrm {i}}\,1{}\mathrm {i}}{2}\right )+\frac {\ln \left (-{\mathrm {e}}^{a\,2{}\mathrm {i}-c\,2{}\mathrm {i}}+{\mathrm {e}}^{a\,2{}\mathrm {i}+b\,x\,2{}\mathrm {i}}\right )\,\left (\frac {{\mathrm {e}}^{-a\,1{}\mathrm {i}+c\,1{}\mathrm {i}}}{2}+\frac {{\mathrm {e}}^{a\,1{}\mathrm {i}-c\,1{}\mathrm {i}}}{2}\right )}{b} \]

[In]

int(cos(a + b*x)/sin(c + b*x),x)

[Out]

(log(exp(a*2i + b*x*2i) - exp(a*2i - c*2i))*(exp(c*1i - a*1i)/2 + exp(a*1i - c*1i)/2))/b - x*((exp(c*1i - a*1i
)*1i)/2 + (exp(a*1i - c*1i)*1i)/2) - x*((exp(c*1i - a*1i)*1i)/2 - (exp(a*1i - c*1i)*1i)/2)